#ifndef DOPPLER_GRAPHICVIEW_H
#define DOPPLER_GRAPHICVIEW_H

#include <QGraphicsView>
#include <QRect>
#include <QRectF>

//class DopplerDataView  ;
class QGraphicsScene;
class DopplerGraphicsItem ;
class GraphicsViewBase;
class DopplerDrawScan ;
class QTimer      ;


class DopplerGraphicView : public QGraphicsView
{
    Q_OBJECT
public:
    explicit DopplerGraphicView(QWidget *parent = 0 , QSize size = QSize(600 , 360));
    ~DopplerGraphicView();

    void   SetDrawOperation(DopplerDrawScan* pDrawScan_);
    void   SetupMatrixScale(double nScaleH_ , double nScaleV_);
    void   EnableRenderOpenGL(bool bEnable_ = true) ;
    void   SetBackgroundBrush(const QColor& cColor_)  ;
    void   AddOverlayItems(QGraphicsItem* item_) ;
    void   SetDrawScan(DopplerDrawScan*  pDrawScan_) ;
    void   UpdateDrawing() ;
    QSize  GetSceneSize() ;



protected:
    void   wheelEvent ( QWheelEvent * event ) ;
    void   resizeEvent(QResizeEvent *event) ;
    void   mousePressEvent(QMouseEvent *event);
    void   mouseReleaseEvent(QMouseEvent *event);
    void   mouseMoveEvent(QMouseEvent *event);
    void   paintEvent(QPaintEvent *event);
    void   InitGraphicView(const QSize& cSize_);
    void   zoomAction() ;
    void   GeometryChanged() ;
    QRectF RangeTranslate(QRectF& rect_) ;
private:
    QGraphicsScene*   m_pScene        ;
    GraphicsViewBase* m_pBackGround   ;
    DopplerDrawScan*  m_pDrawScan     ;
    //DopplerDataView*  m_pParent       ;

    double            m_nScaleH       ;
    double            m_nScaleV       ;
    double            m_nScaleBaseH   ;
    double            m_nScaleBaseV   ;
    QRect             m_cZoomRect     ;
    QPoint            m_cPosStart     ;
    QPoint            m_cPosStop      ;
    bool              m_bItemSelected ;
signals:
    void signalViewChanged(QRectF rect)  ;
    void signalUpdateDrawing();
    void signalItemMoved(DopplerGraphicsItem* item_) ;
public slots:
    void slotResetView();
    void slotPrint();
    void slotUpdateDrawing();

};

#endif // DOPPLER_GRAPHICVIEW_H
